<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>PGManage</title>
    <style type="text/css">
        html, body {
          font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
          font-weight: 400;
          line-height: 1.5;
        }
        html, body {
            display: block;
            margin: 0; padding: 0; border: 0;
            width: 100%; height: 100%;
        }
        html, body {
            overflow: hidden;
        }
        webview {
            display: block;
            margin: 0; padding: 0; border: 0;
            position: absolute;
            top: 30; left: 0;
            width: 100%; height: calc(100% - 30px);
        }
        #loading_interface {
          position: absolute;
          color: #444;
          top: 0; left: 0;
          width: 100%; height: 100%;
        }
        body {
        	background-color: #F2F2F2;
        }
        .omnidb__login {
        	display: flex;
        	align-items: center;
        	justify-content: center;
        	height: 100%;
        }

        .omnidb__login__wrapper {
        	padding: 10px;
        	width: 480px;
        	text-align: center;
        	background-color: #FFFFFF;
        	box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.2);
        	border-radius: 3px;
        	box-sizing: border-box;
        }
        .omnidb__login .div_time {
        	display: inline-block;
        }
        .omnidb__login .omnidb__login__version {
        	color: #828282;
        	position: relative;
        }
        .omnidb__login small {
        	display: block;
        	position: absolute;
        	right: 34px;
          bottom: 10px;
        }
        .omnidb__login .omnidb__login__input-wrapper {
        	position: relative;
        	display: block;
        	margin: 20px 0px;
        	padding-top: 2px;
        	padding-bottom: 2px;
        	background-color: #FFFFFF;
        	transition: 0.45s;
        }
        .omnidb__login {
        	opacity: 0;

        	animation: fadeIn 0.3s linear forwards 0s;
        }

        .omnidb__login .loginWrap-body {
        	height: 0px;
        	overflow: hidden;

        	animation:	growInFromTop 0.4s linear forwards 1.4s;
        }

        .omnidb__login .omnidb__login__version,
        .omnidb__login .omnidb__login__input-wrapper,
        .omnidb__login button {
        	opacity: 0;

        	animation:	fadeIn 0.6s linear forwards 1.8s;
        }
        /* Animated Logo Omnidb styles */
        .pgmanage__login__logo svg {
        	width: 100%;
        }

        #gear-0 path,
        #gear-0 rect {
          animation: fadeIn 0.5s ease forwards 0.2s;
          opacity: 0;
        }

        #gear-1 path,
        #gear-1 rect {
          animation: fadeIn 0.5s ease forwards 0.5s;
          opacity: 0;
        }

        #gear-2 path,
        #gear-2 rect {
          animation: fadeIn 0.5s ease forwards 0.9s;
          opacity: 0;
        }

        #gear-3 path,
        #gear-3 rect {
          animation: fadeIn 0.5s ease forwards 1.2s;
          opacity: 0;
        }

        #text_pg path,
        #text_pg rect,
        #text_manage path,
        #text_manage rect {
          fill-opacity: 0;
          stroke: #818181;
          stroke-width: 1px;

          stroke-dasharray: 100;
          stroke-dashoffset: 100;
        }

        #text_pg path,
        #text_pg rect,
        #text_manage path,
        #text_manage rect {
          animation: svgDrawStrokes 1s linear forwards 0.3s,
            fadeInInfill 0.6s linear forwards 1.3s,
            svgFadeStrokes 0.6s linear forwards 1.3s;
        }


        @keyframes svgDrawStrokes {
          to {
            stroke-dashoffset: 0;
          }
        }

        @keyframes svgFadeStrokes {
          to {
            stroke: transparent;
          }
        }


        @keyframes fadeIn {
          to {
            opacity: 1;
          }
        }

        @keyframes fadeInInfill {
          to {
            fill-opacity: 1;
          }
        }

        @keyframes slideInFromRight {
          to {
            transform: translateX(0);
          }
        }

        @keyframes growInFromTop {
          to {
            height: 400px;
            overflow-y: auto;
          }
        }

        /* GUI DRAG EVENT */
        .gui__webkit-drag {
          -webkit-app-region: drag;
        }

        /* GUI TOP BAR */
        .gui__top-bar {
          align-items: center;
          /* background-color: #4A81D4; */
          /* background-color: #545e6d; */
          background-color: #EFEFEF;
          display: flex;
          height: 30px;
          justify-content: flex-end;
          width: 100%;
        }
        .gui__top-bar__drag-area {
          cursor: grab;
          flex: 1 1 100%;
          height: 30px;
        }
        .gui__top-bar__btn {
          background-color: rgba(0,0,0,0);
          border: none;
          cursor: pointer;
          display: inline-block;
          font-size: 20px;
          line-height: 20px;
          margin: 2px 0px;
          padding: 5px 8px;
          opacity: 0.75;
          transition: 0.35s;
        }
        .gui__top-bar__btn:hover {
          background-color: rgba(0,0,0,0.25);
          opacity: 1;
        }
    </style>
  </head>
  <body id="browser">
    <div id="loading_interface" style="display: none;">
      <div class="omnidb__login">
        <div class="omnidb__login__wrapper">
          <div class="pgmanage__login__logo">
          <?xml version="1.0" encoding="UTF-8" standalone="no"?>
          <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#"
            xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg"
            xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
            xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" class="logo_omnidb" version="1.1" x="0px"
            y="0px" width="269.667px" height="82.333px" viewBox="0 0 269.667 82.333"
            enable-background="new 0 0 269.667 82.333" xml:space="preserve" id="svg903" >

            <g transform="matrix(0.04845922,0,0,0.04845922,8.523555,20.689344)" id="g_symbol" class="logo_pgmanage">
              <ellipse style="fill:#adc9d7;fill-opacity:0.501661;stroke:none" id="ellipse" ry="280.06299" rx="550"
                cy="739.81738" cx="596.9353" />
              <g id="g_gearstack" transform="matrix(1,0,0,0.89246526,0,102.34862)">
                <g transform="translate(-16.983511,7.2102212)" id="gear-0" style="stroke:none">
                  <path style="fill:#003856;fill-opacity:1" id="path870"
                    d="m 1061.2758,757.9066 -0.855,-136.7 c 1.035,-2.308 1.246,-5.124 -0.053,-8.514 l -0.054,-8.672 -4.63,1.998 -3.088,-4.071 8.609,-138.127 -212.60903,-19.998 v -127.574 l -130.337,64.535 -154.83,-4.424 -74.097,-69.674 -107.669,5.457 -5.136,106.34 -19.907,9.856 -61.932,4.428 -123.378,33.222 2.949,144.998 c 0,0 -6.756,8.354 0.036,16.406 l 0.295,134.328 c -1.6,2.753 -2.009,5.915 0.021,9.373 l 39.868,52.369 c 0,0 13.043,8.682 28.222,4.992 l 102.154,-16.421 c 0,0 23.666,1.358 42.123,12.592 l 0.829,92.66 c -0.608,4.036 0.804,10.341 13.741,13.634 l 84.392,20.423 c 0,0 19.465,2.665 27.279,-5.274 l 59.021,-58.451 c 0,0 24.044,-8.611 48.542,-6.714 0,0 42.169,3.833 51.62,11.988 l 48.744,47.185 c 0,0 11.941,14.925 35.763,9.806 l 84.455,-20.39 c 0,0 16.194,-4.171 12.426,-15.45 l 1.343,-92.85 c 0.847,-0.367 1.684,-0.734 2.579,-1.1 0,0 25.195,-15.881 65.245,-8.964 39.973,6.922 76.492,11.7 76.492,11.7 0,0 21.06703,4.338 30.41003,-8.109 9.343,-12.475 30.381,-51.232 30.381,-51.232 0,0 1.573,-2.06 0.017,-5.027 z" />
                  <path style="fill:#316c8b;fill-opacity:1" id="path872"
                    d="m 401.54777,776.3836 84.392,20.423 c 0,0 19.465,2.665 27.279,-5.274 l 59.021,-58.451 c 0,0 24.044,-8.61 48.542,-6.714 0,0 42.169,3.833 51.62,11.988 l 48.744,47.185 c 0,0 11.941,14.925 35.763,9.806 l 84.455,-20.39 c 0,0 17.104,-4.401 12.078,-16.393 l -26.714,-58.561 c 0,0 -10.784,-17.314 30.985,-34.446 0,0 25.195,-15.881 65.245,-8.964 39.973,6.922 76.492,11.7 76.492,11.7 0,0 21.06703,4.338 30.41003,-8.109 9.343,-12.475 30.381,-51.233 30.381,-51.233 0,0 6.796,-8.834 -21.62,-16.287 l -71.16403,-24.101 c 0,0 -21.137,-6.673 -22.925,-25.701 0,0 -7.473,-23.641 7.975,-30.452 l 95.37603,-36.691 c 0,0 18.495,-4.761 12.018,-18.68 l -38.438,-50.666 c 0,0 -15.669,-11.233 -34.76603,-5.644 l -77.517,12.878 c 0,0 -30.931,7.321 -58.663,-10.727 0,0 -32.107,-15.777 -26.362,-31.073 l 24.442,-55.558 c 0,0 8.866,-12.609 -19.402,-18.69 l -79.336,-18.891 c 0,0 -25.775,-3.185 -35.108,7.658 l -43.544,45.118 c 0,0 -8.672,13.986 -43.016,14.93 0,0 -45.967,6.358 -64.085,-11.016 l -50.252,-48.212 c 0,0 -7.547,-11.614 -39.137,-7.374 l -75.198,18.363 c 0,0 -25.863,7.22 -15.667,23.033 l 22.639,50.783 c 0,0 8.209,13.073 -20.745,28.727 0,0 -27.349,20.56 -57.893,15.253 l -87.053,-12.555 c 0,0 -25.698,-5.783 -36.991,9.466 l -29.547,43.609 c 0,0 -13.056,16.139 15.366,25.177 l 82.704,25.278 c 0,0 21.223,12.898 19.845,29.204 0,0 0.52,25.596 -24.917,32.294 l -77.53,27.721 c 0,0 -22.148,8.457 -15.117,20.435 l 39.868,52.369 c 0,0 13.043,8.682 28.222,4.992 l 102.154,-16.421 c 0,0 31.287,1.789 49.97,18.326 0,0 22.036,15.697 21.771,22.488 0,0 -26.063,57.823 -27.53,60.716 -0.003,-0.002 -7.494,12.27 12.48,17.354 z m 25.669,-284.053 c 42.711,-60.742 161.999,-89.812 266.345,-64.966 104.452,24.872 154.397,94.239 111.686,154.981 -42.701,60.728 -161.903,89.857 -266.358,64.984 -104.345,-24.846 -154.375,-94.271 -111.673,-154.999 z" />
                </g>
                <g id="gear-1" transform="translate(-16.983511,-191.89241)">
                  <path style="fill:#dd8a00;fill-opacity:1" id="path870-3"
                    d="m 1061.2758,757.9066 -0.855,-136.7 c 1.035,-2.308 1.246,-5.124 -0.053,-8.514 l -0.054,-8.672 -4.63,1.998 -3.088,-4.071 8.609,-138.127 -212.60903,-19.998 v -127.574 l -130.337,64.535 -154.83,-4.424 -74.097,-69.674 -107.669,5.457 -5.136,106.34 -19.907,9.856 -61.932,4.428 -123.378,33.222 2.949,144.998 c 0,0 -6.756,8.354 0.036,16.406 l 0.295,134.328 c -1.6,2.753 -2.009,5.915 0.021,9.373 l 39.868,52.369 c 0,0 13.043,8.682 28.222,4.992 l 102.154,-16.421 c 0,0 23.666,1.358 42.123,12.592 l 0.829,92.66 c -0.608,4.036 0.804,10.341 13.741,13.634 l 84.392,20.423 c 0,0 19.465,2.665 27.279,-5.274 l 59.021,-58.451 c 0,0 24.044,-8.611 48.542,-6.714 0,0 42.169,3.833 51.62,11.988 l 48.744,47.185 c 0,0 11.941,14.925 35.763,9.806 l 84.455,-20.39 c 0,0 16.194,-4.171 12.426,-15.45 l 1.343,-92.85 c 0.847,-0.367 1.684,-0.734 2.579,-1.1 0,0 25.195,-15.881 65.245,-8.964 39.973,6.922 76.492,11.7 76.492,11.7 0,0 21.06703,4.338 30.41003,-8.109 9.343,-12.475 30.381,-51.232 30.381,-51.232 0,0 1.573,-2.06 0.017,-5.027 z" />
                  <path style="fill:#ffce7d;fill-opacity:1" id="path872-5"
                    d="m 401.54777,776.3836 84.392,20.423 c 0,0 19.465,2.665 27.279,-5.274 l 59.021,-58.451 c 0,0 24.044,-8.61 48.542,-6.714 0,0 42.169,3.833 51.62,11.988 l 48.744,47.185 c 0,0 11.941,14.925 35.763,9.806 l 84.455,-20.39 c 0,0 17.104,-4.401 12.078,-16.393 l -26.714,-58.561 c 0,0 -10.784,-17.314 30.985,-34.446 0,0 25.195,-15.881 65.245,-8.964 39.973,6.922 76.492,11.7 76.492,11.7 0,0 21.06703,4.338 30.41003,-8.109 9.343,-12.475 30.381,-51.233 30.381,-51.233 0,0 6.796,-8.834 -21.62,-16.287 l -71.16403,-24.101 c 0,0 -21.137,-6.673 -22.925,-25.701 0,0 -7.473,-23.641 7.975,-30.452 l 95.37603,-36.691 c 0,0 18.495,-4.761 12.018,-18.68 l -38.438,-50.666 c 0,0 -15.669,-11.233 -34.76603,-5.644 l -77.517,12.878 c 0,0 -30.931,7.321 -58.663,-10.727 0,0 -32.107,-15.777 -26.362,-31.073 l 24.442,-55.558 c 0,0 8.866,-12.609 -19.402,-18.69 l -79.336,-18.891 c 0,0 -25.775,-3.185 -35.108,7.658 l -43.544,45.118 c 0,0 -8.672,13.986 -43.016,14.93 0,0 -45.967,6.358 -64.085,-11.016 l -50.252,-48.212 c 0,0 -7.547,-11.614 -39.137,-7.374 l -75.198,18.363 c 0,0 -25.863,7.22 -15.667,23.033 l 22.639,50.783 c 0,0 8.209,13.073 -20.745,28.727 0,0 -27.349,20.56 -57.893,15.253 l -87.053,-12.555 c 0,0 -25.698,-5.783 -36.991,9.466 l -29.547,43.609 c 0,0 -13.056,16.139 15.366,25.177 l 82.704,25.278 c 0,0 21.223,12.898 19.845,29.204 0,0 0.52,25.596 -24.917,32.294 l -77.53,27.721 c 0,0 -22.148,8.457 -15.117,20.435 l 39.868,52.369 c 0,0 13.043,8.682 28.222,4.992 l 102.154,-16.421 c 0,0 31.287,1.789 49.97,18.326 0,0 22.036,15.697 21.771,22.488 0,0 -26.063,57.823 -27.53,60.716 -0.003,-0.002 -7.494,12.27 12.48,17.354 z m 25.669,-284.053 c 42.711,-60.742 161.999,-89.812 266.345,-64.966 104.452,24.872 154.397,94.239 111.686,154.981 -42.701,60.728 -161.903,89.857 -266.358,64.984 -104.345,-24.846 -154.375,-94.271 -111.673,-154.999 z" />
                </g>
                <g id="gear-2" transform="translate(-16.983511,-392.274)" style="stroke:none">
                  <path style="fill:#be9569;fill-opacity:1" id="path870-6"
                    d="m 1061.2758,757.9066 -0.855,-136.7 c 1.035,-2.308 1.246,-5.124 -0.053,-8.514 l -0.054,-8.672 -4.63,1.998 -3.088,-4.071 8.609,-138.127 -212.60903,-19.998 v -127.574 l -130.337,64.535 -154.83,-4.424 -74.097,-69.674 -107.669,5.457 -5.136,106.34 -19.907,9.856 -61.932,4.428 -123.378,33.222 2.949,144.998 c 0,0 -6.756,8.354 0.036,16.406 l 0.295,134.328 c -1.6,2.753 -2.009,5.915 0.021,9.373 l 39.868,52.369 c 0,0 13.043,8.682 28.222,4.992 l 102.154,-16.421 c 0,0 23.666,1.358 42.123,12.592 l 0.829,92.66 c -0.608,4.036 0.804,10.341 13.741,13.634 l 84.392,20.423 c 0,0 19.465,2.665 27.279,-5.274 l 59.021,-58.451 c 0,0 24.044,-8.611 48.542,-6.714 0,0 42.169,3.833 51.62,11.988 l 48.744,47.185 c 0,0 11.941,14.925 35.763,9.806 l 84.455,-20.39 c 0,0 16.194,-4.171 12.426,-15.45 l 1.343,-92.85 c 0.847,-0.367 1.684,-0.734 2.579,-1.1 0,0 25.195,-15.881 65.245,-8.964 39.973,6.922 76.492,11.7 76.492,11.7 0,0 21.06703,4.338 30.41003,-8.109 9.343,-12.475 30.381,-51.232 30.381,-51.232 0,0 1.573,-2.06 0.017,-5.027 z" />
                  <path style="fill:#dec9b2;fill-opacity:1" id="path872-7"
                    d="m 401.54777,776.3836 84.392,20.423 c 0,0 19.465,2.665 27.279,-5.274 l 59.021,-58.451 c 0,0 24.044,-8.61 48.542,-6.714 0,0 42.169,3.833 51.62,11.988 l 48.744,47.185 c 0,0 11.941,14.925 35.763,9.806 l 84.455,-20.39 c 0,0 17.104,-4.401 12.078,-16.393 l -26.714,-58.561 c 0,0 -10.784,-17.314 30.985,-34.446 0,0 25.195,-15.881 65.245,-8.964 39.973,6.922 76.492,11.7 76.492,11.7 0,0 21.06703,4.338 30.41003,-8.109 9.343,-12.475 30.381,-51.233 30.381,-51.233 0,0 6.796,-8.834 -21.62,-16.287 l -71.16403,-24.101 c 0,0 -21.137,-6.673 -22.925,-25.701 0,0 -7.473,-23.641 7.975,-30.452 l 95.37603,-36.691 c 0,0 18.495,-4.761 12.018,-18.68 l -38.438,-50.666 c 0,0 -15.669,-11.233 -34.76603,-5.644 l -77.517,12.878 c 0,0 -30.931,7.321 -58.663,-10.727 0,0 -32.107,-15.777 -26.362,-31.073 l 24.442,-55.558 c 0,0 8.866,-12.609 -19.402,-18.69 l -79.336,-18.891 c 0,0 -25.775,-3.185 -35.108,7.658 l -43.544,45.118 c 0,0 -8.672,13.986 -43.016,14.93 0,0 -45.967,6.358 -64.085,-11.016 l -50.252,-48.212 c 0,0 -7.547,-11.614 -39.137,-7.374 l -75.198,18.363 c 0,0 -25.863,7.22 -15.667,23.033 l 22.639,50.783 c 0,0 8.209,13.073 -20.745,28.727 0,0 -27.349,20.56 -57.893,15.253 l -87.053,-12.555 c 0,0 -25.698,-5.783 -36.991,9.466 l -29.547,43.609 c 0,0 -13.056,16.139 15.366,25.177 l 82.704,25.278 c 0,0 21.223,12.898 19.845,29.204 0,0 0.52,25.596 -24.917,32.294 l -77.53,27.721 c 0,0 -22.148,8.457 -15.117,20.435 l 39.868,52.369 c 0,0 13.043,8.682 28.222,4.992 l 102.154,-16.421 c 0,0 31.287,1.789 49.97,18.326 0,0 22.036,15.697 21.771,22.488 0,0 -26.063,57.823 -27.53,60.716 -0.003,-0.002 -7.494,12.27 12.48,17.354 z m 25.669,-284.053 c 42.711,-60.742 161.999,-89.812 266.345,-64.966 104.452,24.872 154.397,94.239 111.686,154.981 -42.701,60.728 -161.903,89.857 -266.358,64.984 -104.345,-24.846 -154.375,-94.271 -111.673,-154.999 z" />
                </g>
                <g id="gear-3" transform="translate(-16.983511,-591.24173)">
                  <path style="fill:#31648c;fill-opacity:1" id="path870-2"
                    d="m 1061.2758,757.9066 -0.855,-136.7 c 1.035,-2.308 1.246,-5.124 -0.053,-8.514 l -0.054,-8.672 -4.63,1.998 -3.088,-4.071 8.609,-138.127 -212.60903,-19.998 v -127.574 l -130.337,64.535 -154.83,-4.424 -74.097,-69.674 -107.669,5.457 -5.136,106.34 -19.907,9.856 -61.932,4.428 -123.378,33.222 2.949,144.998 c 0,0 -6.756,8.354 0.036,16.406 l 0.295,134.328 c -1.6,2.753 -2.009,5.915 0.021,9.373 l 39.868,52.369 c 0,0 13.043,8.682 28.222,4.992 l 102.154,-16.421 c 0,0 23.666,1.358 42.123,12.592 l 0.829,92.66 c -0.608,4.036 0.804,10.341 13.741,13.634 l 84.392,20.423 c 0,0 19.465,2.665 27.279,-5.274 l 59.021,-58.451 c 0,0 24.044,-8.611 48.542,-6.714 0,0 42.169,3.833 51.62,11.988 l 48.744,47.185 c 0,0 11.941,14.925 35.763,9.806 l 84.455,-20.39 c 0,0 16.194,-4.171 12.426,-15.45 l 1.343,-92.85 c 0.847,-0.367 1.684,-0.734 2.579,-1.1 0,0 25.195,-15.881 65.245,-8.964 39.973,6.922 76.492,11.7 76.492,11.7 0,0 21.06703,4.338 30.41003,-8.109 9.343,-12.475 30.381,-51.232 30.381,-51.232 0,0 1.573,-2.06 0.017,-5.027 z" />
                  <path style="fill:#aecbe2;fill-opacity:1;stroke:none;stroke-width:21.8437" id="path872-9"
                    d="m 401.54777,776.3836 84.392,20.423 c 0,0 19.465,2.665 27.279,-5.274 l 59.021,-58.451 c 0,0 24.044,-8.61 48.542,-6.714 0,0 42.169,3.833 51.62,11.988 l 48.744,47.185 c 0,0 11.941,14.925 35.763,9.806 l 84.455,-20.39 c 0,0 17.104,-4.401 12.078,-16.393 l -26.714,-58.561 c 0,0 -10.784,-17.314 30.985,-34.446 0,0 25.195,-15.881 65.245,-8.964 39.973,6.922 76.492,11.7 76.492,11.7 0,0 21.06703,4.338 30.41003,-8.109 9.343,-12.475 30.381,-51.233 30.381,-51.233 0,0 6.796,-8.834 -21.62,-16.287 l -71.16403,-24.101 c 0,0 -21.137,-6.673 -22.925,-25.701 0,0 -7.473,-23.641 7.975,-30.452 l 95.37603,-36.691 c 0,0 18.495,-4.761 12.018,-18.68 l -38.438,-50.666 c 0,0 -15.669,-11.233 -34.76603,-5.644 l -77.517,12.878 c 0,0 -30.931,7.321 -58.663,-10.727 0,0 -32.107,-15.777 -26.362,-31.073 l 24.442,-55.558 c 0,0 8.866,-12.609 -19.402,-18.69 l -79.336,-18.891 c 0,0 -25.775,-3.185 -35.108,7.658 l -43.544,45.118 c 0,0 -8.672,13.986 -43.016,14.93 0,0 -45.967,6.358 -64.085,-11.016 l -50.252,-48.212 c 0,0 -7.547,-11.614 -39.137,-7.374 l -75.198,18.363 c 0,0 -25.863,7.22 -15.667,23.033 l 22.639,50.783 c 0,0 8.209,13.073 -20.745,28.727 0,0 -27.349,20.56 -57.893,15.253 l -87.053,-12.555 c 0,0 -25.698,-5.783 -36.991,9.466 l -29.547,43.609 c 0,0 -13.056,16.139 15.366,25.177 l 82.704,25.278 c 0,0 21.223,12.898 19.845,29.204 0,0 0.52,25.596 -24.917,32.294 l -77.53,27.721 c 0,0 -22.148,8.457 -15.117,20.435 l 39.868,52.369 c 0,0 13.043,8.682 28.222,4.992 l 102.154,-16.421 c 0,0 31.287,1.789 49.97,18.326 0,0 22.036,15.697 21.771,22.488 0,0 -26.063,57.823 -27.53,60.716 -0.003,-0.002 -7.494,12.27 12.48,17.354 z m 25.669,-284.053 c 42.711,-60.742 161.999,-89.812 266.345,-64.966 104.452,24.872 154.397,94.239 111.686,154.981 -42.701,60.728 -161.903,89.857 -266.358,64.984 -104.345,-24.846 -154.375,-94.271 -111.673,-154.999 z" />
                </g>
              </g>
            </g>
            <g id="g_logo" transform="matrix(1.0796715,0,0,1.0796715,-5.2477716,-4.161719)"
              style="stroke:none;stroke-width:0.926208;stroke-opacity:1">
              <g aria-label="PG" id="text_pg" style="fill:#31648c">
                <path
                  d="m 75.989932,31.036444 v 19.951891 h 6.270595 V 44.71774 h 1.567648 c 5.843054,0 8.351291,-2.593745 8.351291,-6.840648 0,-4.246902 -2.508237,-6.840648 -8.351291,-6.840648 z m 7.838243,4.987973 c 1.567649,0 2.365724,0.684065 2.365724,1.852675 0,1.168611 -0.798075,1.852676 -2.365724,1.852676 h -1.567648 v -3.705351 z"
                  id="path914" />
                <path
                  d="m 105.28982,44.147686 h 4.50343 c -0.68407,1.482141 -1.90969,2.42273 -4.2184,2.42273 -3.0783,0 -5.13049,-2.052194 -5.13049,-5.558027 0,-3.505832 2.33722,-5.272999 5.13049,-5.272999 1.90968,0 2.90727,1.111605 3.59134,2.365724 l 5.84305,-2.622249 c -1.99519,-2.764762 -4.90247,-5.016475 -9.43439,-5.016475 -6.669637,0 -11.686112,4.018881 -11.686112,10.545999 0,6.527119 4.731448,10.831027 11.401082,10.831027 7.23968,0 11.17306,-5.444016 10.603,-12.256162 h -10.603 z"
                  id="path916" />
              </g>
              <g aria-label="MANAGE" id="text_manage" style="fill:#808080">
                <path
                  d="m 123.8907,38.892082 6.04998,10.253735 6.04999,-10.253735 1.39178,12.099976 h 3.46526 l -2.72676,-20.87672 -8.18027,13.491758 -8.15186,-13.491758 -2.72675,20.87672 h 3.46525 z"
                  id="path863" />
                <path
                  d="m 157.684,50.992058 h 3.80609 l -9.74246,-20.990334 -9.71407,20.990334 h 3.77769 l 2.2723,-5.112666 h 7.29975 z m -5.93637,-14.258658 2.72675,6.305622 h -5.42511 z"
                  id="path865" />
                <path
                  d="M 178.26115,31.109468 V 44.459207 L 163.74686,30.115338 v 20.87672 h 3.29483 V 37.642319 l 14.51429,14.343868 V 31.109468 Z"
                  id="path867" />
                <path
                  d="m 199.51289,50.992058 h 3.80609 l -9.74247,-20.990334 -9.71406,20.990334 h 3.77769 l 2.2723,-5.112666 h 7.29975 z m -5.93638,-14.258658 2.72676,6.305622 h -5.42511 z"
                  id="path869" />
                <path
                  d="m 214.20203,43.436674 h 6.0784 c -0.65329,2.669947 -2.66995,4.857032 -6.22041,4.857032 -3.91971,0 -6.9021,-2.897177 -6.9021,-7.242943 0,-4.345766 3.0676,-7.186136 6.9021,-7.186136 2.75516,0 4.71501,1.249763 5.82275,3.124407 l 2.72676,-1.817837 c -1.76103,-2.755159 -4.65821,-4.430977 -8.54951,-4.430977 -5.99318,0 -10.45257,4.232151 -10.45257,10.310543 0,6.078392 4.37417,10.36735 10.39576,10.36735 6.36243,0 9.91289,-4.999051 9.77087,-10.821809 h -9.57205 z"
                  id="path871" />
                <path
                  d="m 227.21137,31.109468 v 19.88259 h 12.09997 v -2.953985 h -8.80514 v -6.248814 h 8.23707 v -2.897177 h -8.23707 v -4.828629 h 8.80514 v -2.953985 z"
                  id="path873" />
              </g>
            </g>
          </svg>


            <div class="omnidb__login__version">
              <small>version_placeholder</small>
            </div>
          </div>

          <div id="login_wrap_body" class="loginWrap-body">
            <div class="omnidb__login__input-wrapper">

                <div class="loginWrap">
                  <div id="div_time">

                  </div>
                  <div id="loading" class="inputWrap">
              			Starting PGManage...<br/>
              		</div>
                </div>

            </div>
          </div>
        </div>
      </div>
    </div>

    <div id="views">
      <div id ="bar_top" class="gui__top-bar" style="display: none;">
        <div class="gui__webkit-drag gui__top-bar__drag-area">
          <?xml version="1.0" encoding="UTF-8" standalone="no"?>
          <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#"
            xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg"
            xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
            xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" width="72"
            height="28" viewBox="0 0 72 28" fill="none" enable-background="new 0 0 72 28" xml:space="preserve" id="svg14"
            sodipodi:docname="logo_small.svg" inkscape:version="1.0.2 (1.0.2+r75+1)">

            <path
              d="m 6.1878418,10.500279 v 7.32955 h 2.3035726 v -2.303572 h 0.575894 c 2.1465106,0 3.0679386,-0.952842 3.0679386,-2.512989 0,-1.560146 -0.921428,-2.512989 -3.0679386,-2.512989 z m 2.8794666,1.832388 c 0.575893,0 0.869075,0.2513 0.869075,0.680601 0,0.429303 -0.293182,0.680601 -0.869075,0.680601 h -0.575894 v -1.361202 z"
              id="path914" style="fill:#31648c;stroke:none;stroke-width:1;stroke-opacity:1" />
            <path
              d="m 16.951482,15.316841 h 1.654386 c -0.2513,0.54448 -0.701546,0.890017 -1.549676,0.890017 -1.130849,0 -1.884743,-0.753897 -1.884743,-2.041803 0,-1.287907 0.858604,-1.937096 1.884743,-1.937096 0.701542,0 1.068017,0.408361 1.319318,0.869076 l 2.146511,-0.963314 c -0.732956,-1.015665 -1.800978,-1.842857 -3.465829,-1.842857 -2.450166,0 -4.293024,1.476381 -4.293024,3.874191 0,2.397809 1.73815,3.978899 4.188314,3.978899 2.659578,0 4.104549,-1.99992 3.895131,-4.502438 h -3.895131 z"
              id="path916" style="fill:#31648c;stroke:none;stroke-width:1;stroke-opacity:1" />
            <path
              d="m 23.784725,13.386138 2.222528,3.766824 2.222531,-3.766824 0.511286,4.445062 h 1.273002 l -1.001706,-7.669297 -3.005113,4.956348 -2.994677,-4.956348 -1.001702,7.669297 h 1.272998 z"
              id="path863" style="fill:#808080;stroke:none;stroke-width:1;stroke-opacity:1" />
            <path
              d="m 36.199071,17.8312 h 1.39821 L 34.018279,10.120166 30.449707,17.8312 h 1.387777 l 0.834755,-1.878195 h 2.681644 z m -2.180792,-5.238078 1.001703,2.316441 h -1.992975 z"
              id="path865" style="fill:#808080;stroke:none;stroke-width:1;stroke-opacity:1" />
            <path
              d="m 43.758317,10.527108 v 4.904176 L 38.426331,10.161903 V 17.8312 h 1.210392 v -4.904176 l 5.331987,5.26938 v -7.669296 z"
              id="path867" style="fill:#808080;stroke:none;stroke-width:1;stroke-opacity:1" />
            <path
              d="m 51.565382,17.8312 h 1.398209 L 49.384586,10.120166 45.816018,17.8312 h 1.387776 l 0.834755,-1.878195 h 2.681645 z m -2.180796,-5.238078 1.001706,2.316441 h -1.992975 z"
              id="path869" style="fill:#808080;stroke:none;stroke-width:1;stroke-opacity:1" />
            <path
              d="m 56.961601,15.055645 h 2.232969 c -0.239994,0.980835 -0.980836,1.784285 -2.285137,1.784285 -1.43995,0 -2.535564,-1.06431 -2.535564,-2.660776 0,-1.596466 1.126917,-2.639908 2.535564,-2.639908 1.012138,0 1.732111,0.459115 2.139052,1.147786 l 1.001706,-0.667803 c -0.646934,-1.012138 -1.711246,-1.627768 -3.140758,-1.627768 -2.201662,0 -3.839869,1.554728 -3.839869,3.787693 0,2.232965 1.6069,3.808562 3.818999,3.808562 2.33731,0 3.641611,-1.836458 3.589438,-3.975513 h -3.5164 z"
              id="path871" style="fill:#808080;stroke:none;stroke-width:1;stroke-opacity:1" />
            <path
              d="M 61.740728,10.527108 V 17.8312 h 4.445059 V 16.74602 H 62.951121 V 14.450449 H 65.9771 v -1.064311 h -3.025979 v -1.773851 h 3.234666 v -1.085179 z"
              id="path873" style="fill:#808080;stroke:none;stroke-width:1;stroke-opacity:1" />
          </svg>
        </div>
        <a href="#" onclick="guiMinimize()" class="gui__top-bar__btn">
          <svg
              version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
              x="0px" y="0px"
              width="16px" height="16px"
              viewBox="0 0 16 16" enable-background="new 0 0 16 16"
              xml:space="preserve"
          >
            <path
              fill="transparent"
              stroke="#454545"
              stroke-width="2"
              d="m 2 8 h 11"
            />
          </svg>
        </a>
        <a href="#" onclick="guiToggleFullscreen()" class="gui__top-bar__btn">
          <svg
              version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
              x="0px" y="0px"
              width="16px" height="16px"
              viewBox="0 0 16 16" enable-background="new 0 0 16 16"
              xml:space="preserve"
          >
            <path
              fill="transparent"
              stroke="#454545"
              stroke-width="2"
              d="m 2 2 h 11 v 11 h -11z"
            />
          </svg>
        </a>
        <a href="#" onclick="guiClose()" class="gui__top-bar__btn">
          <svg
              version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
              x="0px" y="0px"
              width="16px" height="16px"
              viewBox="0 0 16 16" enable-background="new 0 0 16 16"
              xml:space="preserve"
          >
            <path
              fill="transparent"
              stroke="#454545"
              stroke-width="2"
              d="m 2 2 l 11 11"
            />
            <path
              fill="transparent"
              stroke="#454545"
              stroke-width="2"
              d="m 2 13 l 11 -11"
            />
          </svg>
        </a>
      </div>
      <webview id="view" class="page" src="" autosize="on" style=""></webview>
    </div>
  <script>

  function simulate_startup(p_window, p_list, p_loading_data_container, p_loading_data_content, p_webview) {
    if (p_list.length>0) {
      var string = p_list.shift();
      p_loading_data_content.innerHTML += '<br/>' + string;
      setTimeout(function() {
        simulate_startup(p_window, p_list, p_loading_data_container, p_loading_data_content, p_webview);
      },2000);
    }
    // Done with the startup, adjust page and load PGManage
    else {
      p_loading_data_container.style.display = 'none';

      p_window.width = 1280;
      p_window.height = 1024;

      p_window.x = Math.floor((window.screen.availWidth/2) - (p_window.width/2));
      p_window.y = Math.floor((window.screen.availHeight/2) - (p_window.height/2));

      document.getElementById('bar_top').style.display = '';
      p_webview.style.display = '';
      p_webview.src = 'http://192.168.100.21:8000';
    }
  }

  try {

    var gui = require('nw.gui');
    let win = gui.Window.get();
    let django = null;
    let v_loading_data_container = document.getElementById('loading_interface');
    let v_loading_data_content = document.getElementById('loading');
    let v_login_wrap_body = document.getElementById('login_wrap_body');
    let v_webview = document.getElementById('view');

    var winState;
    var currWinMode;
    var resizeTimeout;
    var isMaximizationEvent = false;
    // extra height added in linux x64 gnome-shell env, use it as workaround
    var deltaHeight = gui.App.manifest.window.frame ? 0 : 'disabled';

    function initWindowState() {
        winState = JSON.parse(localStorage.windowState || 'null');

        if (winState) {
            currWinMode = winState.mode;
            if (currWinMode === 'maximized') {
                win.maximize();
            } else {
                restoreWindowState();
            }
        } else {
            currWinMode = 'normal';
            win.width = 1024;
            win.height = 768;
            dumpWindowState();
        }

        win.show();
    }

    function dumpWindowState() {
        if (!winState) {
            winState = {};
        }

        // we don't want to save minimized state, only maximized or normal
        if (currWinMode === 'maximized') {
            winState.mode = 'maximized';
        } else {
            winState.mode = 'normal';
        }

        // when window is maximized you want to preserve normal
        // window dimensions to restore them later (even between sessions)
        if (currWinMode === 'normal') {
            winState.x = win.x;
            winState.y = win.y;
            winState.width = win.width;
            winState.height = win.height;

            // save delta only of it is not zero
            if (deltaHeight !== 'disabled' && deltaHeight !== 0 && currWinMode !== 'maximized') {
                winState.deltaHeight = deltaHeight;
            }
        }
    }

    function restoreWindowState() {
        // deltaHeight already saved, so just restore it and adjust window height
        if (deltaHeight !== 'disabled' && typeof winState.deltaHeight !== 'undefined') {
            deltaHeight = winState.deltaHeight
            winState.height = winState.height - deltaHeight
        }
        //Make sure that the window is displayed somewhere on a screen that is connected to the PC.
        //Imagine you run the program on a secondary screen connected to a laptop - and then the next time you start the
        //program the screen is not connected...
        gui.Screen.Init();
        var screens = gui.Screen.screens;
        var locationIsOnAScreen = false;
        for (var i = 0; i < screens.length; i++) {
            var screen = screens[i];
            if (winState.x > screen.bounds.x && winState.x < screen.bounds.x + screen.bounds.width) {
                if (winState.y > screen.bounds.y && winState.y < screen.bounds.y + screen.bounds.height) {
                    console.debug("Location of window (" + winState.x + "," + winState.y + ") is on screen " + JSON.stringify(screen));
                    locationIsOnAScreen = true;
                }
            }
        }

        if (!locationIsOnAScreen) {
            win.setPosition("center");
        }
        else {
            win.resizeTo(winState.width, winState.height);
            win.moveTo(winState.x, winState.y);
        }
    }

    function saveWindowState() {
        dumpWindowState();
        localStorage['windowState'] = JSON.stringify(winState);
    }

    // handle newwindow messages from the webview
    // allows for opening of webapp links in the default system browser
    v_webview.addEventListener('newwindow', async (e) => {
      const protocol = (new URL(e.targetUrl)).protocol
      if (protocol === 'http:' || protocol === 'https:') {
        await gui.Shell.openExternal(e.targetUrl)
      }
    })


    // allow csv/xls download during data export
    // https://developer.chrome.com/docs/extensions/reference/webviewTag/#event-permissionrequest
    v_webview.addEventListener('permissionrequest', function(e) {
      if (e.permission === 'download') {
        e.request.allow();
      }
    });

    const child_process = require('child_process')
    const path = require('path')
    const url = require('url')

    // Prepare loading interface
    win.width = 600;
    win.height = 600;

    win.x = Math.floor((window.screen.availWidth/2) - (win.width/2));
    win.y = Math.floor((window.screen.availHeight/2) - (win.height/2));
    win.show()
    v_loading_data_container.style.display = '';

    win.on('maximize', function () {
        isMaximizationEvent = true;
        currWinMode = 'maximized';
    });

    win.on('unmaximize', function () {
        currWinMode = 'normal';
        restoreWindowState();
    });

    win.on('minimize', function () {
        currWinMode = 'minimized';
    });

    win.on('restore', function () {
        currWinMode = 'normal';
    });

    win.on('close', function() {
        try {
            saveWindowState();
        } catch(err) {
            console.log("winstateError: " + err);
        }

        if (django!=null) {
          try {
            process.kill(django.pid);
          }
          catch (e) {
          }
        }
        nw.App.quit();
    });

    win.on('closed', function() {
      if (django!=null) {
          process.kill(django.pid)
      }
    })

    process.on('exit', () => {
      try{
        process.kill(django.pid)
      }
      catch (e) {}
      nw.App.quit();
    })

    if (process.platform === 'darwin') {
      process.env.PATH=path.join('/usr/local/bin', path.delimiter, process.env.PATH)
    }

    setTimeout(function() {
      django = child_process.spawn(path.join(global.__dirname,'pgmanage-server/pgmanage-server'),['-A'],{detached: false});

      django.stderr.on('data', (data) => {
       v_loading_data_content.innerHTML += `${data}` + '<br/>';
      });

      django.stdout.on('data', (data) => {
        lines = data.toString().split('\n');

        lines.forEach((line) => {
          if(line == '')
            return

          if (line.substring(0, 4)!='http') {
            v_loading_data_content.innerHTML += line + '<br/>';
            if (v_login_wrap_body) {
              v_login_wrap_body.scrollTo(0,99999);
            }
          } else {
            v_loading_data_content.innerHTML += 'Opening PGManage...<br/>';
            (function(value) { setTimeout( function() {
              v_loading_data_container.style.display = 'none';
              win.setMinimumSize(1024, 768)
              initWindowState()

              document.getElementById('bar_top').style.display = '';
              v_webview.style.display = '';
              v_webview.src = value;
            }, 500);
          })(line);
          }
        })
      });

    },100);

    let simulate_startup_list = [
      'Initiating phase 1...',
      'Phase 1 completed.',
      'Initiating phase 2...',
      'Phase 2 completed.',
      'Loading PGManage...'
    ];
    /*
    setTimeout(function(){
      simulate_startup(v_window, simulate_startup_list, v_loading_data_container, v_loading_data_content, v_webview);
    }, 1100);*/

    // GUI controls
    function guiMinimize() {
      win.minimize();
    }
    function guiToggleFullscreen() {
      var v_is_maximized = (screen.availWidth - window.innerWidth === 0);
      if (v_is_maximized) {
        win.restore();
      }
      else {
        win.maximize();
      }
    }
    function guiClose() {
      win.close();
    }

  }
  catch(e) {
    document.write(e);
  }
  </script>
</html>
